home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SGI Developer Toolbox 6.1
/
SGI Developer Toolbox 6.1 - Disc 4.iso
/
src
/
haeberli
/
fonttools
/
fonttest.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-08-01
|
4KB
|
191 lines
/*
* Copyright 1991, 1992, 1993, 1994, Silicon Graphics, Inc.
* All Rights Reserved.
*
* This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
* the contents of this file may not be disclosed to third parties, copied or
* duplicated in any form, in whole or in part, without the prior written
* permission of Silicon Graphics, Inc.
*
* RESTRICTED RIGHTS LEGEND:
* Use, duplication or disclosure by the Government is subject to restrictions
* as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
* and Computer Software clause at DFARS 252.227-7013, and/or in similar or
* successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
* rights reserved under the Copyright Laws of the United States.
*/
/*
* fonttest -
* Test object fonts.
*
* Paul Haeberli - 1990
*
*/
#include "gl.h"
#include "device.h"
#include "stdio.h"
#include "objfnt.h"
float fgetmousex();
float fgetmousey();
float spin, warp;
int doaa, dofill;
char ofname[256];
char mfname[256];
main(argc,argv)
int argc;
char **argv;
{
short val;
int menu;
if(argc<2) {
fprintf(stderr,"usage: fonttest: Font-Name\n");
exit(1);
}
keepaspect(85,110);
winopen("fonttest");
subpixel(1);
RGBmode();
doublebuffer();
gconfig();
menu = defpup("fonttest %t|toggle fill|toggle smooth");
sprintf(ofname,"%s.of",argv[1]);
sprintf(mfname,"%s.mf",argv[1]);
makeframe();
qdevice(LEFTMOUSE);
qdevice(MIDDLEMOUSE);
qdevice(MENUBUTTON);
while(1) {
switch(qread(&val)) {
case REDRAW:
makeframe();
break;
case LEFTMOUSE:
while(getbutton(LEFTMOUSE)) {
spin = fgetmousex();
warp = fgetmousey();
makeframe();
}
break;
case MIDDLEMOUSE:
if(val)
savergbwindow("save.rgb");
break;
case RIGHTMOUSE:
if(val) {
switch(dopup(menu)) {
case 1:
dofill = 1-dofill;
makeframe();
break;
case 2:
doaa = 1-doaa;
makeframe();
break;
}
}
}
}
}
makeframe()
{
int i;
reshapeviewport();
ortho2(0.0,72*8.5,0.0,72*11.0);
cpack(0x00ffffff);
clear();
cpack(0xff000000);
if(doaa) {
if(dofill) {
fontname(mfname);
drawit();
}
blendfunction(BF_SA,BF_MSA);
linesmooth(SML_ON);
fontname(ofname);
drawit();
blendfunction(BF_ONE,BF_ZERO);
linesmooth(SML_OFF);
} else {
if(dofill)
fontname(mfname);
else
fontname(ofname);
pushmatrix();
for(i=0; i<1; i++) {
drawit();
translate(1.0,1.0,0.0);
}
popmatrix();
}
swapbuffers();
}
dowarp()
{
float s;
s = 1.0-warp;
scale(s,s,s);
}
drawit(name)
{
pushmatrix();
rot(20.0*spin,'z');
fontsetsize(0.75);
scale(72.0,72.0,0.0);
translate(0.0,9.0,0.0);
dowarp();
fontmoveto(4.0,0.0);
fontcentershow("AaBbCcDdEeFf");
translate(0.0,-1.0,0.0);
dowarp();
fontmoveto(4.0,0.0);
fontcentershow("GgHhIiJjKkLl");
translate(0.0,-1.0,0.0);
dowarp();
fontmoveto(4.0,0.0);
fontcentershow("MmNnOoPpQqRr");
translate(0.0,-1.0,0.0);
dowarp();
fontmoveto(4.0,0.0);
fontcentershow("SsTtUuVvWwXx");
translate(0.0,-1.0,0.0);
dowarp();
fontmoveto(4.0,0.0);
fontcentershow("YyZz");
translate(0.0,-1.0,0.0);
dowarp();
fontmoveto(4.0,0.0);
fontcentershow("1234567890");
translate(0.0,-1.0,0.0);
dowarp();
fontmoveto(4.0,0.0);
fontcentershow("~!@#$%^&*\(\)_+,.");
translate(0.0,-1.0,0.0);
dowarp();
fontmoveto(4.0,0.0);
fontcentershow("-={}[]|\\:;\"'<>?");
popmatrix();
}